Skip to content

Add 48 C++ MSTest tests for LightSwitch#46934

Open
crutkas wants to merge 5 commits intomicrosoft:mainfrom
crutkas:split/lightswitch-tests
Open

Add 48 C++ MSTest tests for LightSwitch#46934
crutkas wants to merge 5 commits intomicrosoft:mainfrom
crutkas:split/lightswitch-tests

Conversation

@crutkas
Copy link
Copy Markdown
Member

@crutkas crutkas commented Apr 12, 2026

Summary

48 new TEST_METHODs covering LightSwitch:

  • ShouldBeLight schedule logic with fixed times and midnight wraparound
  • Sunrise/sunset daylight-duration validation (timezone-wrap safe)
  • ScheduleMode enum serialization round-trip
  • Config defaults

Split from #46905 (5/7) — see that PR for full context.

Files Changed (7)

  • src/modules/LightSwitch/UnitTests/LightSwitchTests.cpp (new)
  • src/modules/LightSwitch/UnitTests/UnitTests-LightSwitch.vcxproj (new)
  • src/modules/LightSwitch/UnitTests/UnitTests-LightSwitch.vcxproj.filters (new)
  • src/modules/LightSwitch/UnitTests/pch.cpp (new)
  • src/modules/LightSwitch/UnitTests/pch.h (new)
  • PowerToys.slnx (modified — +1 project ref in /modules/LightSwitch/Tests/)
  • .github/actions/spell-check/expect.txt (modified)

ShouldBeLight schedule logic with fixed times and midnight wraparound,
sunrise/sunset daylight-duration validation (timezone-wrap safe),
ScheduleMode enum serialization round-trip, and config defaults.

Split from PR microsoft#46905 (5/7)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@crutkas crutkas added the Area-Tests issues that relate to tests label Apr 12, 2026
@crutkas
Copy link
Copy Markdown
Member Author

crutkas commented Apr 12, 2026

/azp run

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Apr 12, 2026
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An engineer--not a computer--needs to verify each of these test cases to ensure that they are worthwhile and on-target.

- Created LightSwitchTypes.h with ScheduleMode, ToString/FromString, LightSwitchConfig
- Modified LightSwitchSettings.h to include LightSwitchTypes.h
- Removed copy-pasted definitions from test file (20 tests now test real code)
- Extracted CoordinatesAreValid to LightSwitchUtils.h as free function
- Added 6 CoordinatesAreValid tests
- Added 2 polar-region SunCalc edge case tests (documenting -1 sentinel bug)
- Added deep comments to all 56 test methods

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tests issues that relate to tests Needs-Review This Pull Request awaits the review of a maintainer.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants